package cn.javase.io_model.bio._03_伪异步IO编程;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {

    public static void main(String[] args) {
        try(ServerSocket server = new ServerSocket(9999)) {
            SocketServerPool socketServerPool = new SocketServerPool(6, 10);
            while (true) {
                Socket socket = server.accept();
                /*  TODO 将socket封装成任务对象交给线程池 */
                ServerRunnableTarget target = new ServerRunnableTarget(socket);
                socketServerPool.execute(target);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

}
